﻿using System.Collections.Generic;
using System;
using System.ComponentModel.DataAnnotations;

namespace Web.Models
{
    public class SpUser
    {
        [Key]
        public int SpUserId { get; set; }
        public string Email { get; set; }
        public string Password { get; set; }
        public SpUserDetail Detail { get; set; }
        public ICollection<Ticket> Tickets { get; set; }
        public Company Company { get; set; }
    }
    
    public class Company
    {
        [Key]
        public int CompanyId { get; set; }
        public string CompanyName { get; set; }
        public Address Address { get; set; }
    }

    public class Address
    {
        [Key]
        public int AddressId { get; set; }
        public string Line1 { get; set; }
        public string Line2 { get; set; }
        public string Line3 { get; set; }
        public string City { get; set; }
        public string County { get; set; }
        public string Country { get; set; }
        public string Postcode { get; set; }
    }

    public class SpUserDetail
    {
        [Key]
        public int SpUserDetailId { get; set; }
        public string Name { get; set; }
        public string LastName { get; set; }
    }

    public class Ticket
    {
        [Key] 
        public int TicketId { get; set; }
        public SpUser ReportedBy { get; set; }
        public SpUser ResolvedBy { get; set; }
        public DateTime Opened { get; set; }
        public DateTime Closed { get; set; }
        public DateTime Updated { get; set; }
        public TicketStatus Status { get; set; }
        public string Detail { get; set; }
        public ICollection<TicketHistory> History { get; set; }
        public SpUser AssignedTo { get; set; }
    }
    public class TicketHistory
    {
        [Key]
        public int TicketHistoryId { get; set; }
        public SpUser UpdatedBy { get; set; }
        public DateTime Updated { get; set; }
        public TicketStatus Status { get; set; }
        public int TicketDetailId { get; set; }
        public decimal HoursSpent { get; set; }
        public string Descriptions { get; set; }
     }

    public enum TicketStatus
    {
        Open,
        WithUser,
        InProgress,
        Closed,
        Resolved, 
        Reopen,
        Verified,
    }

    public enum AccountType
    {
        Administrator,
        SupportUser,
        Company,
    }
}
